/*
 * @Author: xiehangyun 
 * @Date: 2025-05-16 18:15:40 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-06-27 16:36:59
 */

import { SilhouetteData, SilhouetteGroupData } from "@/types/type";
import { makeAutoObservable } from "mobx";

class IndexStore {

    constructor() {
        makeAutoObservable(this, {}, { deep: false });
    }

    page = 1;//当前页面
    pageSize = 10;//分页数
    total = 0;//总数
    silhouetteGroups: Array<SilhouetteGroupData> = [
        {
            silhouette_group_id: 1, ifShow: true, name: "T恤", sort: 1, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "T恤1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "T恤2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 2, ifShow: true, name: "POLO衫", sort: 2, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "POLO衫1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "POLO衫2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 3, ifShow: true, name: "卫衣", sort: 3, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "卫衣1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "卫衣2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 4, ifShow: true, name: "连帽衫", sort: 4, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "连帽衫1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "连帽衫2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 5, ifShow: true, name: "衬衫", sort: 5, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "衬衫1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "衬衫2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 6, ifShow: true, name: "外套", sort: 6, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "外套1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "外套2", price: 100 },
            ]
        },
        {
            silhouette_group_id: 7, ifShow: true, name: "夹克", sort: 7, silhouettes: [
                { silhouette_id: 1, ifShow: true, sort: 1, name: "夹克1", price: 100 },
                { silhouette_id: 2, ifShow: true, sort: 2, name: "夹克2", price: 100 },
            ]
        },
    ];//数据列表
    //请求数据
    async getList(page: number = 1, pageSize: number = 10) {
        this.page = page;
        this.pageSize = pageSize;
        this.silhouetteGroups = [];// 请求数据
    }
    //新增数据
    add(data: any) {
        // 新增完后请求数据
        this.getList();
    }
    //删除数据
    delete(id: string) {
        // 删除完后请求数据
        this.getList();
    }
    //更新数据
    updata(data: any) {
        // 更新完后请求数据
        this.getList();
    }

    // 计数测试
    count1 = 0;
    count2 = 0;
    // 计数方法
    addCount = () => {
        this.count1++;
        this.count2++;
    }

};

const indexStore = new IndexStore();

export default indexStore;
